package com.centriole.service.workflow.entity;

public class ProNode extends BaseEntity {
	private static final long serialVersionUID = -464547164632109323L;

	private String processId;
	private String viewId;
	private String editId;
	private String code;
	private String nodeName;
	private String allowStop;
	private String allowRecall;
	private String allowHang;
	private String allowBack;
	private String noticeId;
	private String functionId;
	public String getProcessId() {
		return processId;
	}
	public void setProcessId(String processId) {
		this.processId = processId;
	}
	public String getViewId() {
		return viewId;
	}
	public void setViewId(String viewId) {
		this.viewId = viewId;
	}
	public String getEditId() {
		return editId;
	}
	public void setEditId(String editId) {
		this.editId = editId;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getNodeName() {
		return nodeName;
	}
	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}
	public String getAllowStop() {
		return allowStop;
	}
	public void setAllowStop(String allowStop) {
		this.allowStop = allowStop;
	}
	public String getAllowRecall() {
		return allowRecall;
	}
	public void setAllowRecall(String allowRecall) {
		this.allowRecall = allowRecall;
	}
	public String getAllowHang() {
		return allowHang;
	}
	public void setAllowHang(String allowHang) {
		this.allowHang = allowHang;
	}
	public String getAllowBack() {
		return allowBack;
	}
	public void setAllowBack(String allowBack) {
		this.allowBack = allowBack;
	}
	public String getNoticeId() {
		return noticeId;
	}
	public void setNoticeId(String noticeId) {
		this.noticeId = noticeId;
	}
	public String getFunctionId() {
		return functionId;
	}
	public void setFunctionId(String functionId) {
		this.functionId = functionId;
	}
	
	/**
	 * 获取节点实体的任务类型(比如: 单任务userTask、审批examine)
	 * @return	String 任务类型("userTask" , "examine" ...)
	 */
	public String getTaskType() {
		String[] codeArray =getCode().split("-");
		if(codeArray.length == 2) {
			return codeArray[1];
		}else {
			return codeArray[0];
		}
	}
	
	/**
	 * 获取节点实体的节点Id
	 * @return	String 节点Id("demo_node_1" , "demo_node_2" 等)
	 */
	public String getNodeId() {
		return getCode().split("-")[0];
	}
	
	@Override
	public String toString() {
		return "ProNode [processId=" + processId + ", viewId=" + viewId + ", editId=" + editId + ", code=" + code
				+ ", nodeName=" + nodeName + ", allowStop=" + allowStop + ", allowRecall=" + allowRecall
				+ ", allowHang=" + allowHang + ", allowBack=" + allowBack + ", noticeId=" + noticeId + ", functionId="
				+ functionId + "]";
	}
	
	/**
	 * 获取存在分隔符"-"后的nodeName【后半部分】,如果不存在分隔符则直接输出nodeName
	 * @return	nodeName:"a-b" ,返回b
	 */
	public String getNodeNameBySplit() {
		String[] array = nodeName.split("-");
		return array.length >= 2?array[1]:nodeName;
	}
	
	/**
	 * 获取存在分隔符"-"后的nodeName【前半部分】,如果不存在分隔符则直接输出nodeName
	 * @return		nodeName:"a-b" ,返回a
	 */
	public String getNodeNameBySplit0() {
		String[] array = nodeName.split("-");
		return array.length >= 2?array[0]:nodeName;
	}
}
